package com.wcy.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;

import com.wcy.annotation.pageVo.PageColumn;
import com.wcy.annotation.pageVo.PageName;
import com.wcy.annotation.pageVo.SelectionAnnotation;
import lombok.*;
import lombok.experimental.Accessors;
/**
 * <p>
 * 
 * </p>
 *
 * @author 吴传亿
 * @since 2025-04-28
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@TableName("user_rating")
@PageName(name = "用户评分")
public class UserRating {

    @PageColumn(prop="userId", label="用户Id",type = "select",selectRef = @SelectionAnnotation(apiUrl = "user/list",mapProp = "userId",mapLabel = "username"))
    private Integer userId;

    @PageColumn(prop="resourceId", label="资源Id",type = "select",selectRef = @SelectionAnnotation(apiUrl = "resource/list",mapProp = "resourceId",mapLabel = "title"))
    private Integer resourceId;

    @PageColumn(prop="ratingValue", label="评分",type = "rating")
    private Double ratingValue;

    @PageColumn(prop="ratedAt", label="评分时间",type = "date-picker")
    private LocalDateTime ratedAt;

    public UserRating(Integer userId, Integer resourceId, Double ratingValue){
        this.userId = userId;
        this.resourceId = resourceId;
        this.ratingValue = ratingValue;
    }
}
